import { Component } from "react";
import HelloWorld from "./HelloWorld";
import HelloWorld1 from "./HelloWorld1";
class App extends Component {
  constructor() {
    super()

    this.state = {
      isShowHW: true
    }
  }

  toggleShow() {
    this.setState({
      isShowHW: !this.state.isShowHW
    })
  }

  render() {
    const { isShowHW } = this.state
    return (
      <>
      <HelloWorld1></HelloWorld1>
      {isShowHW && <HelloWorld></HelloWorld>}
      <button onClick={() => this.toggleShow()}>切换组件显示</button>
      </>
    )
  }


}

export default App